Skip to content

Comments

refactor: use text cases to convert to title case#374

Merged
brunodam merged 1 commit intomainfrom
00371-title-case-built-in-method
Feb 21, 2026
Merged

refactor: use text cases to convert to title case#374
brunodam merged 1 commit intomainfrom
00371-title-case-built-in-method

Conversation

@brunodam
Copy link
Contributor

@brunodam brunodam commented Feb 20, 2026

Description

This pull request updates the node_spec.go file in the hardware package to improve how display names are formatted. The main change is replacing the custom capitalize function with a more robust title-casing approach using the golang.org/x/text/cases package.

Formatting improvements:

  • Replaced the custom capitalize function with the cases.Title function from the golang.org/x/text/cases package in formatDisplayName, ensuring proper title-casing for node type and profile names.
  • Added imports for golang.org/x/text/cases and golang.org/x/text/language to support the new title-casing functionality.

Related Issues

Signed-off-by: Bruno De Assis Marques <bruno.marques@swirldslabs.com>
Copilot AI review requested due to automatic review settings February 20, 2026 19:11
@brunodam brunodam requested a review from a team as a code owner February 20, 2026 19:11
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request refactors the display name formatting in the hardware package to use the standard golang.org/x/text/cases library instead of a custom capitalize function. This improves code maintainability and provides more robust Unicode handling while maintaining identical behavior for existing node types and profiles.

Changes:

  • Replaced custom capitalize function with cases.Title(language.Und) from the standard text/cases library
  • Added imports for golang.org/x/text/cases and golang.org/x/text/language
  • Simplified formatDisplayName to use the standard library caser

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@brunodam brunodam requested review from leninmehedy and nathanklick and removed request for crypto-pablo February 20, 2026 20:40
Copy link
Member

@leninmehedy leninmehedy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@brunodam brunodam merged commit fefa802 into main Feb 21, 2026
17 checks passed
@brunodam brunodam deleted the 00371-title-case-built-in-method branch February 21, 2026 00:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use the title case built-in method

2 participants